pandas column string first n characters

26

df1['StateInitial'] = df1['State'].str[:2]
print(df1)  

Comments

Submit
0 Comments